package dou;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;

public class lao {
    public static void main(String[] args) {
        ste ss = new ste("INSERT INTO wang.table_name (name, age, sex, 备注) VALUES ('丽丽', 15, '女', null);");
        Thread one = new Thread(ss);
        one.start();

    }
}

class ste implements Runnable {
    public String stee;

    public ste(String stee) {
        this.stee = stee;
    }

    @Override
    public void run() {
        Connection c = null;
        try {
            c = DriverManager.getConnection("jdbc:mysql:/wang?user=root");
            var s = c.prepareStatement("null");
            var a = s.execute(stee);
        } catch (SQLException e) {
            e.printStackTrace();
        }
        while (true) {
            synchronized (this) {
                try {
                    System.out.println(stee);
                    var s = c.prepareStatement(stee);
                    s.close();
                    c.close();
                    break;
                } catch (SQLException e) {
                    e.printStackTrace();
                }
            }
        }

    }
}